/**
* DSPengLai - Championship helper
* Copyright (C) 2008  Crisanto, Israel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*/
#include "Competitor.hpp"

using namespace std;

/** **/
Competitor::Competitor(string n) : name(n) {
   // reseta todas as notas
   notes[0] = 0; notes[1] = 0;
   notes[2] = 0; notes[3] = 0;
   notes[4] = 0;

   //
   high = 0;
   low = 0;
}

/** **/
void Competitor::setNote(int n, float v) {
   //
   if(v > notes[high]) high = n;
   else if(v < notes[low]) low = n;

   //seta a nota
   notes[n] = v;
}

/** **/
float Competitor::getFullMedia() {
   float* i = notes;
   return (i[0] + i[1] + i[2] + i[4]) / 5;
}
